package com.control.qct.businesssteward.adapter;

import android.support.annotation.Nullable;
import android.widget.ImageView;

import com.control.qct.businesssteward.R;
import com.control.qct.businesssteward.model.OrderDetailModel;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.control.qct.businesssteward.utils.DecimalFormatUtils;
import com.control.qct.businesssteward.utils.GlideUtil;

import java.util.List;

/**
 * Created by Administrator on 2018/1/10 0010.
 */

public class OrderDetailAdapter extends BaseQuickAdapter<OrderDetailModel.DetailsBean, BaseViewHolder> {
    public OrderDetailAdapter(@Nullable List<OrderDetailModel.DetailsBean> data) {
        super(R.layout.rv_order_goods_detail_item, data);
    }

    @Override
    protected void convert(BaseViewHolder holder, OrderDetailModel.DetailsBean item) {
        GlideUtil.loadImage(mContext,item.getImageUrl(), (ImageView) holder.getView(R.id.iv_goods_picture));
        holder.setText(R.id.tv_goods_name, item.getTitle() + "/" + item.getUnit()).setText(R.id.tv_goods_barcode,
                item.getBarcode()).setText(R.id.tv_goods_type, item.getCategoryTitle()).setText(R.id.tv_goods_price,
                "￥"+DecimalFormatUtils.DecimalFormatTwo(item.getActualPrice())).setText(R.id.tv_goods_num, "x"+item
                .getPurchaseNumber());
    }
}
